#! /usr/bin/env python3
# coding: utf-8
# author: maxiao
# date: 2023-06-08 11:26
# description: 使用deque模块实现对文件末行内容的显示

from collections import deque


def tail(filename: str='99.py', num: int=10):
    """显示文件末尾n行的内容"""
    with open(filename, 'r', encoding='utf-8') as f:
        return deque(f, num)


obj = tail()
for i, j in enumerate(obj):
    print(f"{i:<2} --> {j}", end='')

